package org.zjt.weather.demo;

import org.apache.hadoop.io.DoubleWritable;
import org.apache.hadoop.mapreduce.lib.partition.HashPartitioner;

/**
 * DESC    对mapper后的数据按照reduce分区，分区后的数据保存在内存或者磁盘中。
 *
 * @author
 * @create 2017-05-23 下午2:01
 **/
public class WeatherPartition extends HashPartitioner<WeatherKey, DoubleWritable> {
    @Override
    public int getPartition(WeatherKey key, DoubleWritable value, int numReduceTasks) {
        return key.getYear() % numReduceTasks;
    }
}
